<?php

namespace Zeke\Zee;
use \Zeke\Zee\Container\Container;


/**
 * Get the available container instance.
 *
 * @param  string  $abstract
 * @param  array   $parameters
 * @return mixed|\Zeke\Zee\App
 */
function app($abstract = null, array $parameters = [])
{
    if (is_null($abstract)) {
        return Container::getInstance();
    }

    return empty($parameters)
        ? Container::getInstance()->make($abstract)
        : Container::getInstance()->makeWith($abstract, $parameters);
}


/**
 * socket 转 fd
 * @param resource $socket
 * @return int
 * @author <liu.bin@ruaby.com> 2018-08-04 09:52
 */
function intFd($socket)
{
    return (int)$socket;
}
